from fastapi import FastAPI, Request, Response


def permission(app: FastAPI):
    @app.middleware("http")
    async def permission(request: Request, call_next):
        print("permission is run ")
        path = request.url.path
        print("request.url.path", path)
        print("request.url", request.url)
        print("request scope-->", request.scope)
        # print("request endpoint-->", app.url_path_for(path))
        response: Response = await call_next(request)

        return response



